package com.example.kmsealdemo.controller;

import com.example.kmsealdemo.service.ISealdemoService;
import com.example.kmsealdemo.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/kmSealdemo")
public class SealdemoController {

    private static final Logger logger = LoggerFactory.getLogger(SealdemoController.class);

    @Autowired
    ISealdemoService sealdemoService;

    @PostMapping("/getSealBase64")
    public Result getSealBase64(@RequestBody String base64Str) throws Exception {
        try {
            String seal = sealdemoService.getSeal(base64Str);
            return Result.success(seal);
        } catch (Exception e) {
            logger.error("签章失败：{}",e.getMessage());
            return Result.error(e.getMessage());
        }
    }
}
